package com.yztstudy.clients;

import com.yztstudy.clients.impl.UserHystrixImpl;
import com.yztstudy.entity.User;
import com.yztstudy.param.CartListParam;
import com.yztstudy.param.PageParam;
import com.yztstudy.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "user-service", fallback = UserHystrixImpl.class)
public interface UserFeignClient {

    /**
     * TODO 分页查询用户列表
     * @param pageParam 分页参数
     * @return
     */
    @PostMapping("/user/admin/list")
    public R listPage(@RequestBody PageParam pageParam);


    /**
     * TODO 删除某一个用户
     * @param cartListParam 用户的ID
     * @return
     */
    @PostMapping("/user/admin/remove")
    public R remove(@RequestBody CartListParam cartListParam);


    /**
     * TODO 更新用户
     * @param user 用户
     * @return
     */
    @PostMapping("/user/admin/update")
    public R update(@RequestBody User user);


    /**
     * TODO 添加用户
     * @param user 用户
     * @return
     */
    @PostMapping("/user/admin/save")
    public R save(@RequestBody User user);
}
